package com.cxplan.projection;

import com.cxplan.projection.ui.component.ItemMeta;

import java.util.HashMap;
import java.util.Map;

/**
 * Created on 2017/5/24.
 *
 * @author kenny
 */
public class MonkeyConstant {

    /**
     * The monkey event.
     */
    public final static short EVENT_TYPE = 1;
    public final static short EVENT_PRESS = 2;
    public final static short EVENT_TOUCH_DOWN = 3;
    public final static short EVENT_TOUCH_MOVE = 4;
    public final static short EVENT_TOUCH_UP = 5;
    public final static short EVENT_TOUCH = 6;//down and then up
    public final static short EVENT_KEY_DOWN = 7;//press down
    public final static short EVENT_KEY_UP = 8;//press up
    public final static short EVENT_WAKE = 9;//wake screen.
    public final static short EVENT_SLEEP = 10;//make screen sleeping.
    public final static short EVENT_SCROLL = 13;//scroll up the phone window
    public static final short MONKEY_SWITCH_INPUTER = 100;

    /**
     * Monkey keycode
     */
    public final static int KEYCODE_BACK_SPACE = 67;
    public final static int KEYCODE_DELETE = 112;
    public final static int KEYCODE_ENTER = 66;
    public final static int KEYCODE_LEFT = 21;
    public final static int KEYCODE_DOWN = 20;
    public final static int KEYCODE_UP = 19;
    public final static int KEYCODE_RIGHT = 22;
    public final static int KEYCODE_TAB = 61;
    /** Key code constant: Volume Up key.
     * Adjusts the speaker volume up. */
    public static final int KEYCODE_VOLUME_UP       = 24;
    /** Key code constant: Volume Down key.
     * Adjusts the speaker volume down. */
    public static final int KEYCODE_VOLUME_DOWN     = 25;
    public final static int KEYCODE_BACK = 4;
    public final static int KEYCODE_HOME = 3;
    public final static int KEYCODE_APP_SWITCH = 187;
    public final static int KEYCODE_POWER = 26;
    /** Key code constant: Brightness Down key.
     * Adjusts the screen brightness down. */
    public static final int KEYCODE_BRIGHTNESS_DOWN = 220;
    /** Key code constant: Brightness Up key.
     * Adjusts the screen brightness up. */
    public static final int KEYCODE_BRIGHTNESS_UP   = 221;
    //-----------special keycode
    /** Key code constant: Camera key.
     * Used to launch a camera application or take pictures. */
    public static final int KEYCODE_CAMERA          = 27;


    /**
     * Rotation constant: 0 degree rotation (natural orientation)
     */
    public static final int ROTATION_0 = 0;
    /**
     * Rotation constant: 90 degree rotation.
     */
    public static final int ROTATION_90 = 1;
    /**
     * Rotation constant: 180 degree rotation.
     */
    public static final int ROTATION_180 = 2;
    /**
     * Rotation constant: 270 degree rotation.
     */
    public static final int ROTATION_270 = 3;

    public static Map<Integer, ItemMeta<Integer>> KEY_CODE_MAP = new HashMap<>();
    static {
        KEY_CODE_MAP.put(KEYCODE_BACK_SPACE, new ItemMeta<>("Back Delete", KEYCODE_BACK_SPACE));
        KEY_CODE_MAP.put(KEYCODE_DELETE, new ItemMeta<>("Forward Delete", KEYCODE_DELETE));
        KEY_CODE_MAP.put(KEYCODE_ENTER, new ItemMeta<>("Enter", KEYCODE_ENTER));
        KEY_CODE_MAP.put(KEYCODE_LEFT, new ItemMeta<>("Arrow Left", KEYCODE_LEFT));
        KEY_CODE_MAP.put(KEYCODE_RIGHT, new ItemMeta<>("Arrow Right", KEYCODE_RIGHT));
        KEY_CODE_MAP.put(KEYCODE_UP, new ItemMeta<>("Arrow Up", KEYCODE_UP));
        KEY_CODE_MAP.put(KEYCODE_DOWN, new ItemMeta<>("Arrow Down", KEYCODE_DOWN));
        KEY_CODE_MAP.put(KEYCODE_TAB, new ItemMeta<>("TAB", KEYCODE_TAB));
        KEY_CODE_MAP.put(KEYCODE_VOLUME_UP, new ItemMeta<>("Volume Up", KEYCODE_VOLUME_UP));
        KEY_CODE_MAP.put(KEYCODE_VOLUME_DOWN, new ItemMeta<>("Volume Down", KEYCODE_VOLUME_DOWN));
        KEY_CODE_MAP.put(KEYCODE_BRIGHTNESS_UP, new ItemMeta<>("Brightness Up", KEYCODE_BRIGHTNESS_UP));
        KEY_CODE_MAP.put(KEYCODE_BRIGHTNESS_DOWN, new ItemMeta<>("Brightness Down", KEYCODE_BRIGHTNESS_DOWN));
        KEY_CODE_MAP.put(KEYCODE_BACK, new ItemMeta<>("Back", KEYCODE_BACK));
        KEY_CODE_MAP.put(KEYCODE_HOME, new ItemMeta<>("Home", KEYCODE_HOME));
        KEY_CODE_MAP.put(KEYCODE_APP_SWITCH, new ItemMeta<>("App Switch", KEYCODE_APP_SWITCH));
        KEY_CODE_MAP.put(KEYCODE_POWER, new ItemMeta<>("Power", KEYCODE_POWER));
        KEY_CODE_MAP.put(KEYCODE_CAMERA, new ItemMeta<>("Camera", KEYCODE_CAMERA));
    }
}
